// Do not remove the include below
#include "LibStandard.h"


// state
static int g_bSerialInited = false;

// locally-scoped forward declarations
bool Serial_init();
bool LED_init(int pin);


//The setup function is called once at startup of the sketch
//void setup()
//{}

//// The loop function is called in an endless loop
//void loop()
//{}

bool  standard_init(int ledPin)
{
	if (! LED_init(ledPin))
	{
		return false;
	}

	if (! Serial_init())
	{
		return false;
	}

	return true;
}

void standard_deinit()
{
	Serial.end();
}

void Serial_msg(const char* szMsg)
{
	Serial_init();

	if (g_bSerialInited)
	{
		Serial.println(szMsg);
	}
}

bool Serial_init()
{
	if (! g_bSerialInited)
	{
		// open serial port
		Serial.begin(115200);
		g_bSerialInited = true;
	}

	return g_bSerialInited;
}

bool LED_init(int pin)
{
	pinMode(pin, OUTPUT);
	digitalWrite(pin, HIGH);

	return true;
}



